import VueRouter from 'vue-router'

const arr = ['push', 'reqlace']

arr.forEach((item) => {
  const arrItem = VueRouter.prototype[item]

  VueRouter.prototype[item] = function (path, scuuessCb, errorCb) {
    if (scuuessCb || errorCb) {
      arrItem.call(this, path, scuuessCb, errorCb)
    } else {
      arrItem.call(this, path).catch(() => {})
    }
  }
})
